<?php
// +----------------------------------------------------------------------
// | ManniuCMS
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://manniuyun.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: heitao <cms@manniuyun.com>
// +----------------------------------------------------------------------

namespace app\book\validate;

use think\Validate;

class Chapter extends Validate{

    protected $rule = [
        // 主表字段
        'book_id'       => ['require','number','token'],
        'chapter_name'  => ['require'],
        /*
        'price'         => ['require','number'],
        'words'         => ['require','number'],
        */
        'volume'        => ['require','number'],
        'charge'        => ['require','number','in'=>'0,1'],
        'status'        => ['require','number','in'=>'0,1']
    ];

    protected $message  = [
        // 主表字段提示信息
        'book_id.require'       => '图书id不存在',
        'book_id.number'        => '图书id必须是数字',

        'chapter_name.require'  => '章节名称不能为空',
        /*
        'price.require'         => '收费价格必填',
        'price.number'          => '收费价格必须为数字',
        
        'words.require'         => '收费价格必填',
        'words.number'          => '收费价格必须为数字',
        */
        'volume.require'        => '分卷必填',
        'volume.number'         => '分卷值必须为数字',

        'charge.require'        => '是否收费标识必选',
        'charge.number'         => '是否收费标识必须为数字',
        'charge.in'             => '是否收费标识的值必是0或1',

        'status.require'        => '状态标识必选',
        'status.number'         => '状态标识必须为数字',
        'status.in'             => '状态标识的值必是0或1'
    ];
}